import request from '@/utils/request'

/**
 * 获取仪表盘统计数据
 * @returns {Promise<Object>} 统计数据
 */
export function getDashboardStats() {
  console.log('调用getDashboardStats API');
  return request({
    url: '/api/dashboard/stats',
    method: 'get'
  }).then(res => {
    console.log('getDashboardStats响应:', res);
    return res;
  }).catch(err => {
    console.error('getDashboardStats错误:', err);
    throw err;
  });
}

/**
 * 获取最近活动
 * @returns {Promise<Object>} 活动列表
 */
export function getRecentActivities() {
  console.log('调用getRecentActivities API');
  return request({
    url: '/api/dashboard/activities',
    method: 'get'
  }).then(res => {
    console.log('getRecentActivities响应:', res);
    return res;
  }).catch(err => {
    console.error('getRecentActivities错误:', err);
    throw err;
  });
}

/**
 * 获取系统信息
 * @returns {Promise<Object>} 系统信息
 */
export function getSystemInfo() {
  console.log('调用getSystemInfo API');
  return request({
    url: '/api/dashboard/system-info',
    method: 'get'
  }).then(res => {
    console.log('getSystemInfo响应:', res);
    return res;
  }).catch(err => {
    console.error('getSystemInfo错误:', err);
    throw err;
  });
} 